package com.mxpio.erp.workshop.service.impl;

import com.mxpio.erp.common.workshop.entity.DefectiveProductsNoticeLineException;
import com.mxpio.erp.common.workshop.service.DefectiveProductsNoticeLineExceptionService;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.jpa.query.Operator;
import com.mxpioframework.jpa.query.Order;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class DefectiveProductsNoticeLineExceptionServiceImpl extends BaseServiceImpl<DefectiveProductsNoticeLineException> implements DefectiveProductsNoticeLineExceptionService {

    @Override
    @Transactional
    public Result<List<DefectiveProductsNoticeLineException>> getListByParentKey(String noticeNo, String lineNo) {
        Criteria criteria = Criteria.create();
        criteria.addCriterion("noticeNo", Operator.EQ,noticeNo);
        criteria.addCriterion("lineNo", Operator.EQ,lineNo);
        criteria.addOrder(new Order("sort", false));
        List<DefectiveProductsNoticeLineException> list = this.list(DefectiveProductsNoticeLineException.class, criteria);
        return Result.OK(list);
    }
}
